package com.ly.control;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ly.bean.LYReplyMemoryBean;

public class LYReplyMemoryServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public LYReplyMemoryServlet() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		PrintWriter out = response.getWriter();

		out.flush();
		out.close();
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		InputStream in = request.getInputStream();
		LYReplyMemoryBean frb = new LYReplyMemoryBean();
		String re = frb.replymemory(in);
		out.write(re);
		// System.out.println(re);
		out.flush();
		out.close();
	}

	public void init() throws ServletException {
		// Put your code here
	}

}
